#include "Rain.h"
#include "DXUTcamera.h"

extern CFirstPersonCamera g_camera;

void Rain::InitParticle(Particle& out)
{
	// Generate about the camera.
	out.initialPosition = *g_camera.GetEyePt();

	// Spread the particles out on xz-plane.
	out.initialPosition.x += GetRandomFloat(-100.0f, 100.0f);
	out.initialPosition.z += GetRandomFloat(-100.0f, 100.0f);

	// Generate above the camera.
	out.initialPosition.y += GetRandomFloat(50.0f, 55.0f);

	out.initialTime      = m_time;
	out.lifeTime        = GetRandomFloat(2.0f, 2.5f);
	out.initialColor    = D3DCOLOR_ARGB(255 ,255, 255, 255);
	out.initialSize     = GetRandomFloat(6.0f, 7.0f);

	// Give them an initial falling down velocity.
	out.initialVelocity.x = GetRandomFloat(-1.5f, 0.0f);
	out.initialVelocity.y = GetRandomFloat(-50.0f, -45.0f);
	out.initialVelocity.z = GetRandomFloat(-0.5f, 0.5f);
}
